package com.cskaoyan.controller;

import com.cskaoyan.bean.bo.WxFeedbackSubmitBO;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.common.User;
import com.cskaoyan.bean.po.MarketUser;
import com.cskaoyan.service.WxFeedbackService;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author zhuqiushi
 * @since 2022/09/09 15:58
 */
@RestController
@RequestMapping("wx/feedback")
public class WxFeedbackController {
    @Autowired
    WxFeedbackService wxFeedbackService;

    /*
     * /wx/feedback/submit
     * POST
     * */
    @RequestMapping("submit")
    public BaseRespVo submit(@RequestBody @Valid WxFeedbackSubmitBO wxFeedbackSubmitBO, BindingResult bindingResult) {
        MarketUser info = (MarketUser) SecurityUtils.getSubject().getSession().getAttribute("info");
        //调用service层插入
        int code = wxFeedbackService.submit(wxFeedbackSubmitBO, info);
        return BaseRespVo.ok();
    }
}
